package com.shaobufan.museum.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.io.Serializable;

/**
 * 馆藏表
 * &#064;TableName  museum_collections
 */
@TableName(value ="museum_collections")
@Data
public class Collections implements Serializable {
    /**
     * 藏品id
     */
    @TableId(value = "collection_id", type = IdType.AUTO)
    private Integer collectionId;

    /**
     * 类别id
     */
    @TableField(value = "category_id")
    private Integer categoryId;

    /**
     * 藏品年份
     */
    @TableField(value = "collection_era")
    private String collectionEra;

    /**
     * 藏品详情
     */
    @TableField(value = "collection_detail")
    private String collectionDetail;

    /**
     * 藏品名称
     */
    @TableField(value = "collection_name")
    private String collectionName;

    /**
     * 藏品图片
     */
    @TableField(value = "collection_image")
    private String collectionImage;

    /**
     * 逻辑删除
     */
    @TableField(value = "is_delete")
    @TableLogic
    private Integer isDelete;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Collections other = (Collections) that;
        return (this.getCollectionId() == null ? other.getCollectionId() == null : this.getCollectionId().equals(other.getCollectionId()))
            && (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
            && (this.getCollectionEra() == null ? other.getCollectionEra() == null : this.getCollectionEra().equals(other.getCollectionEra()))
            && (this.getCollectionDetail() == null ? other.getCollectionDetail() == null : this.getCollectionDetail().equals(other.getCollectionDetail()))
            && (this.getCollectionName() == null ? other.getCollectionName() == null : this.getCollectionName().equals(other.getCollectionName()))
            && (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getCollectionId() == null) ? 0 : getCollectionId().hashCode());
        result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
        result = prime * result + ((getCollectionEra() == null) ? 0 : getCollectionEra().hashCode());
        result = prime * result + ((getCollectionDetail() == null) ? 0 : getCollectionDetail().hashCode());
        result = prime * result + ((getCollectionName() == null) ? 0 : getCollectionName().hashCode());
        result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", collectionId=").append(collectionId);
        sb.append(", categoryId=").append(categoryId);
        sb.append(", collectionEra=").append(collectionEra);
        sb.append(", collectionDetail=").append(collectionDetail);
        sb.append(", collectionName=").append(collectionName);
        sb.append(", isDelete=").append(isDelete);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}